package cn.hycat.leetcode.weekCode;

/**
 * @author 吕泽浩业
 * @version 1.0
 */
public class L6047移除指定数字得到的最大结果 {
    public static void main(String[] args) {
        System.out.println(removeDigit("123", '3'));
    }
    public static String removeDigit(String number, char digit) {
        String ans = "";
        char[] str = number.toCharArray();
        for(int i = 0; i < str.length; i++) {
            if(digit == str[i]) {
                String temp = number.substring(0, i) + number.substring(i + 1);
                ans = temp.compareTo(ans) < 0 ? ans : temp;
            }
        }
        return ans;
    }
}
